package com.tjetc.controller;

import com.tjetc.common.FileUploadUtil;
import com.tjetc.common.JsonResult;
import com.tjetc.service.CityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("city")
public class CityController {

    @Value("${file.basePath}")
    private  String basepath;
    @Autowired
    CityService cityService;
    @RequestMapping("detail/{id}")
    public JsonResult detail(@PathVariable("id") Long id) {
        return cityService.findCityById(id);
    }
    @RequestMapping("top/{length}")
    public JsonResult selecttop(@PathVariable("length") Integer length) {
        return cityService.getTop(length);
    }
    @RequestMapping("theme/{clazz}")
    public JsonResult selectclass(@PathVariable("clazz") Integer classId) {
        return cityService.getClazz(classId);
    }

    @RequestMapping("province/{provinceId}")
    public JsonResult getByProvince(@PathVariable("provinceId") Long provinceId) {
        return cityService.getCitiesByProvince(provinceId);
    }
}
